var t = getApp();

Page({
    data: {
        text: "分销消费积分",
        active: 0,
        current_page: 1,
        last_page: 1,
        list: [],
        expect_commission: 0,
        unsettle_commission: 0,
        settle_commission: 0,
        close_commission: 0,
        invalid_commission: 0,
        nickname: "",
        avatar_image: ""
    },
    onLoad: function(t) {
        this.getData(), this.getList();
    },
    onReady: function() {},
    onChange: function(t) {
        this.setData({
            active: t.detail.name
        }), this.getList();
    },
    getMoreData: function() {
        var a = this, e = this.data.current_page + 1;
        t._getNetWork({
            url: t.getNetAddresss("plugin.commission-point.frontend.index.list"),
            data: {
                page: e,
                status: this.data.active
            },
            success: function(t) {
                if (t.data.result) {
                    var e = a.data.list.concat(t.data.data.data), s = t.data.data.last_page, i = t.data.data.current_page;
                    a.setData({
                        list: e,
                        last_page: s,
                        current_page: i
                    });
                }
            }
        });
    },
    getList: function() {
        var a = this;
        t._postNetWork({
            url: t.getNetAddresss("plugin.commission-point.frontend.index.list"),
            data: {
                status: this.data.active
            },
            success: function(t) {
                t.data.result && a.setData({
                    list: t.data.data.data,
                    last_page: t.data.data.last_page
                });
            }
        });
    },
    getData: function() {
        var a = this;
        t._getNetWork({
            url: t.getNetAddresss("plugin.commission-point.frontend.index.index"),
            success: function(t) {
                if (t.data.result) {
                    var e = t.data.data, s = e.expect_commission, i = e.unsettle_commission, n = e.settle_commission, o = e.close_commission, c = e.invalid_commission, d = e.member, m = d.nickname, r = d.avatar_image;
                    wx.setNavigationBarTitle({
                        title: t.data.data.plugin_name || "分销消费积分"
                    }), a.setData({
                        expect_commission: s,
                        unsettle_commission: i,
                        settle_commission: n,
                        close_commission: o,
                        invalid_commission: c,
                        nickname: m,
                        avatar_image: r
                    });
                }
            }
        });
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (this.data.current_page >= this.data.last_page) return !1;
        this.getMoreData();
    },
    onShareAppMessage: function() {}
});